import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserModule } from './user/user.module';
import { User } from './user/entities/user.entity';
import { JwtModule } from '@nestjs/jwt';
import { Permission } from './user/entities/perssion.entity';
import { Role } from './user/entities/role.entity';
import { JournalModule } from './journal/journal.module';
import { ChannelModule } from './channel/channel.module';
import { AuthModule } from './auth/auth.module';
import { Channel } from './channel/entities/channel.entity';
import { RedisModule } from './redis/redis.module';
import { ScheduleModule } from '@nestjs/schedule';
import { TaskModule } from './task/task.module';
import { WeatherModule } from './weather/weather.module';
import { HttpModule } from '@nestjs/axios';
import { ShortUrlModule } from './short-url/short-url.module';
import { ShortUrl } from './short-url/entities/short-url.entity';
import { ShortLongMap } from './short-url/entities/short-long-map.entity';
import { SseModule } from './sse/sse.module';
import { QrcodeModule } from './qrcode/qrcode.module';


@Module({
    imports: [
        TypeOrmModule.forRoot({
            type: 'mysql',
            host: 'localhost',
            port: 3306,
            username: 'root',
            password: 'Lrq000905',
            // password:'200095',
            database: 'login-system',
            synchronize: true,
            logging: false,
            entities: [User , Permission , Role , Channel , ShortUrl , ShortLongMap],
            poolSize: 10,
            connectorPackage: 'mysql2',
        }),
        JwtModule.register({
            global:true , // 把jwt设置全局
            secret:"qiang-test-secret",
            signOptions:{
                expiresIn:'7d' // 过期时间 七天
            }
        }),
       
        ScheduleModule.forRoot() , // 引入定时任务
        UserModule,
        JournalModule,
        ChannelModule,
        AuthModule,
        // RedisModule,
        TaskModule,
        WeatherModule,
        ShortUrlModule,
        SseModule,
        QrcodeModule,
    ],
    controllers: [],

})
export class AppModule { }
